<template>
  <div>
    <!--搜索表单-->
    <div style="margin-bottom: 20px">
      <el-input style="width: 240px" placeholder="请输入教室号查询" v-model="params.roomid"></el-input>
      <el-input style="width: 240px" placeholder="请输入学工号/教职工号查询" v-model="params.stdid"></el-input>
      <el-button style="margin-left: 5px" type="primary" @click="load"><i class="el-icon-search"></i>搜索</el-button>
    </div>
    <el-table :data="tableData" stripe>
      <el-table-column prop="number" label="序号"></el-table-column>
      <el-table-column prop="roomid" label="教室号"></el-table-column>
      <el-table-column prop="stdid" label="学工号/教职工号"></el-table-column>
      <el-table-column prop="name" label="借用者姓名"></el-table-column>
      <el-table-column prop="phone" label="电话"></el-table-column>
      <el-table-column prop="borrowtime" label="借用时间"></el-table-column>
    </el-table>
    <!--分页-->
    <div>
      <el-pagination
          background
          :current-page="params.pageNum"
          :page-size="params.pageSize"
          layout="prev, pager, next"
          @current-change="handelCurrentChange"
          :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import request from "@/utils/request";

export default {
  name: 'Check.vue',
  data() {
    return {
      tableData: [],
      total: 0,
      params: {
        pageNum: 1,
        pageSize: 10,
        roomid: '',
        stdid: ''
      }
    }
  },
  created() {
    this.load()
  },
  methods: {
    load() {
      request.get('/record/page', {
        params: this.params
      }).then(res => {
        this.tableData = res.data.list
        this.total = res.data.total
        if (res.code === '200') {
          this.tableData = res.data.list
          this.total = res.data.total
        }
      })
    },
    handelCurrentChange(pageNum) {
      this.params.pageNum = pageNum
      this.load()
    }
  }
}
</script>

<style scoped>

</style>